# Maintainer: Will Sinatra <wpsinatra@gmail.com>
# Contributor: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-simplecov-html
_gemname=${pkgname#ruby-}
pkgver=0.13.1
pkgrel=0
pkgdesc="Generate an HTML coverage report"
url="https://rubygems.org/gems/simplecov-html"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-rake ruby-bundler ruby-rspec"
source="$pkgname-$pkgver.tar.gz::https://github.com/simplecov-ruby/simplecov-html/archive/refs/tags/v$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"
subpackages="$pkgname-doc"
options="!check" #depends on rubocop

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc

	install -Dm644 "$builddir"/LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}

sha512sums="
2a90696b057eda26e7738268e991e37df253d0c134d55edb40afebbab6edc1585fef46a319ee46295a99018461eed9615bc5dd4e30baad1d1310ecb22403a697  ruby-simplecov-html-0.13.1.tar.gz
e6d3e48ce92200af3bfa7130f35407b8d16d227c5f71370ef4d5dad7813d6f1e21c4e619d29d1501ede181be7a2ace0be24774e4d0ef7c15b6c26055bcbf2a67  gemspec.patch
"
